package net.xiduth.game.player.dialogues.impl;

import net.xiduth.game.item.Item;
import net.xiduth.game.player.Skills;
import net.xiduth.game.player.dialogues.Dialogue;
import net.xiduth.utils.Misc.LampType;

/**
 * 
 * @author Jae <jae@xiduth.com>
 * 
 * @since <Oct 18, 2013>
 *
 */
public class SkillExperienceLamp extends Dialogue {
	
	int skill;
	LampType type;
	Item item;

	@Override
	public void start() {
		int skill = (Integer) parameters[0];
		type = (LampType) parameters[1];
		item = (Item) parameters[2];
		sendOptionsDialogue("Rub lamp?", "Gain " + type.name().toLowerCase() + " <col=FF0000>" + Skills.SKILL_NAME[skill] + "</col> experience", "Cancel.");
	}

	@Override
	public void run(int interfaceId, int componentId) {
		int skill = (Integer) parameters[0];
		type = (LampType) parameters[1];
		item = (Item) parameters[2];
		if (componentId == OPTION_1) {
			double modifier = type == LampType.LARGE ? 6: type == LampType.SMALL ? 4 : 3;
			player.getSkills().addXp(skill, player.getSkills().getLevel(skill) * modifier);
			player.getInventory().deleteItem(item);
		} else {
			end();
		}
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		
	}

}
